/*

The video widget allows to play videos. It has the following params:

controls:
    if true, the normal controls will be used for stopping, seeking, etc
    
autoplay:
    if true, the video will play automatically
    
source:
    the source for the widget
*/

tree.ui.Video = Class({
	extend: tree.ui.Widget,
	
	init: function(params)
	{
	    tree.ui.Widget.apply(this);
		this.htmlelem = document.createElement('video');
		if(params.source)
		{
		    this.htmlelem.src = params.source;
		}
		if(params.autoplay)
		{
		    this.htmlelem.autoplay = params.autoplay;
		}
		if(params.controls)
		{
		    this.htmlelem.controls = true;
		}
        this.text = '';
	},
    play: function()
    {
        this.htmlelem.play();
    },

    pause: function()
    {
        this.htmlelem.pause();
    },

    set_source: function(src)
    {
	    this.htmlelem.src = src;
    },
});
